﻿using Kavaa.Core.Data;
using Kavaa.Modules.PortailMedical.Entity;
using System;

namespace Kavaa.Modules.PortailMedical.Datalayer
{
    internal static class RessourceDAO 
    { 
        public static Ressources GetRessources()
        {
            Ressources ressources = new Ressources();

            foreach (var row in SqlDaoAdapter.ExecuteReader(
                ConfigurationCache.DatabaseConnectionString,
                "[dbo].[sp_PortailMedical_GetRessources]"
           ))
            {
                ressources.Add(new Ressource()
                {
                    Id = (row["RessourceId"] != DBNull.Value) ? Convert.ToInt32(row["RessourceId"]) : 0,
                    Name = (row["RessourceName"] != DBNull.Value) ? Convert.ToString(row["RessourceName"]) : null,
                  

                });
            }

            return ressources;
        }
    }
}
